package com.bawei.test.strategy

import com.bawei.test.strategy.logger.*
import kotlin.math.log

/**
 * @Author : yaotianxue
 * @Time : On 2023/5/22 11:06
 * @Description : Logger
 */
//构造方法传入策略
class Logger(var loggerStrategy: LoggerStrategy) {
    var logger:ILogger
    //初始化代码块：根据不同的策略返回不同logger对象
    init {
        when(loggerStrategy){
            LoggerStrategy.LOGCAT -> logger = LogcatLogger()
            LoggerStrategy.FILE -> logger = FileLogger()
            LoggerStrategy.NET -> logger = NetLogger()
            LoggerStrategy.EMAIL -> logger = EmailLogger()
        }
    }

}